<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let zongshu = 1000
        let i = true
        while (i) {
            let choice = prompt(`请选择操作：
            1. 存钱
            2. 取钱
            3. 查看余额
            4. 退出`);
            choice = parseInt(choice);
            switch (choice) {
                case 1:
                    let cunshu = +prompt("请输入存钱金额：")
                    if (cun> 0) {
                        zongshu += cunshu
                        alert(`存钱成功，当前余额：${zongshu}`)
                    } else {
                        alert("存钱金额输入错误，请输入有效的正数")
                    }
                    break;
                case 2:
                    let qushu = +prompt("请输入取钱金额：");
                    if (qushu > 0 && qushu <= zongshu) {
                        zongshu -= qushu
                        alert(`取钱成功，当前余额：${zongshu}`);
                    } else if (qushu > zongshu) {
                        alert("余额不足");
                    } else {
                        alert("取钱金额输入错误，请输入有效的正数");
                    }
                    break;
                case 3:
                    alert(`当前余额：${zongshu}`);
                    break;
                case 4:
                    i = false;
                    alert("感谢使用，再见")
                    break;
                default:
                    alert("输入错误，请选择 1-4 之间的数字")
            }
        }
    </script>
</body>
</html>